#include "stdafx.h"

int main(int argc, char* argv[])
{
	if ( !RegisterFont( "Resources/Fonts/packard_antique.ttf", 20, "fontSmall" ) )
	{
		sysLog.Log( "Failed to load font fontSmall" );
		return 1;
	}

	if ( !RegisterFont( "Resources/Fonts/packard_antique.ttf", 26, "fontLarge" ) )
	{
		sysLog.Log( "Failed to load font fontLarge" );
		return 1;
	}

	if ( !LoadBlueprints( "blueprints.txt" ) )
	{
		sysLog.Log( "Failed to load blueprints from bps.txt" );
		return 1;
	}

	if ( !HSDialog::LoadDialogs( "dialogs.txt" ) )
	{
		sysLog.Log( "Failed to load dialogs from dialogs.txt" );
		return 1;
	}

	if ( !HSInventory::LoadItems( "items.txt" ) )
	{
		sysLog.Log( "Failed to load items from items.txt" );
		return 1;
	}

	//HSSettings::uiScreenWidth = 1366;
	//HSSettings::uiScreenHeight = 768;

	HSSettings::uiScreenWidth = 800;
	HSSettings::uiScreenHeight = 600;
	
	theWorld.Initialize( HSSettings::uiScreenWidth, HSSettings::uiScreenHeight, "Hack And Slash", false, false, true );
	
	HSSettings::fScrW = MathUtil::PixelsToWorldUnits( HSSettings::uiScreenWidth );
	HSSettings::fScrH = MathUtil::PixelsToWorldUnits( HSSettings::uiScreenHeight );

	if ( !thePlayer.Load( "Zephiron" ) )
	{
		sysLog.Log( "Failed to load player" );
		return 1;
	}
	
	if ( !theLevel.Load( "grassland.txt" ) )
	{
		sysLog.Log( "Failed to load level" );
		return 1;
	}

	theInv.AddItem( "sword1" );
	theInv.AddItem( "leather1" );
	theInv.AddItem( "copperhelmet1" );
	theInv.AddItem( "coppermail1" );
	theInv.AddItem( "copperpants1" );
	thePlayer.Activate();
	theLevel.Activate();
	
	// do all your setup first, because this function won't return until you're exiting
	theWorld.StartGame();
	
	// any cleanup can go here
	theWorld.Destroy();
	
	return 0;
}
